class SlotMachineLotteryDraw extends eui.Component implements  eui.UIComponent {
	public constructor() {
		super();
		this.skinName = 'SlotMachineLotteryDrawSkin';
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}

	private xuehua1;
	private liwu01;
	private liwu02;
	private liwu03;
	private lijilingqu;
	private start;
	private is_start;
	private fanhui;
	private zhongjiangyemian;
	private choujiangji;
	private channel;
	private click=0;
	protected childrenCreated():void
	{
		super.childrenCreated();
		var music =RES.getRes("Aaron Angello - Our Canon In D_mp3");
		this.channel=music.play();
		this.playAnimation(this.xuehua1,true);
		this.lijilingqu.addEventListener(egret.TouchEvent.TOUCH_END,function(){
		if(mc.currentFrame==mc1.currentFrame&&mc1.currentFrame==mc2.currentFrame&&this.click>0){
			var jiangpin=new egret.Bitmap();
			jiangpin.texture=mc.movieClipData.getTextureByFrame(mc.currentFrame);
			jiangpin.x=330;
			jiangpin.y=590;
			this.zhongjiangyemian.addChild(jiangpin);
		}	
		this.zhongjiangyemian.visible = true;
		this.choujiangji.visible = false;
		this.removeChild(mc);
		this.removeChild(mc1);
		this.removeChild(mc2);
		},this);
		this.fanhui.addEventListener(egret.TouchEvent.TOUCH_END,function(){
			 SceneManages.getInstance(this.stage).loadSence('ReceivePraiseResult',OneMorePlayGame);
			 this.channel.stop();
			 this.channel = null;
		},this);
		
	   let mcFactory =new egret.MovieClipDataFactory(RES.getRes("choujiang_json"),RES.getRes("choujiang_png"));
       let mc = new egret.MovieClip(mcFactory.generateMovieClipData("6"));
	   mc.x=172.82;
	   mc.y=708.67;
       this.addChild(mc);
	   let mc1 = new egret.MovieClip(mcFactory.generateMovieClipData("6"));
	   mc1.x=327;
	   mc1.y=708.67;
       this.addChild(mc1);
	   let mc2 = new egret.MovieClip(mcFactory.generateMovieClipData("6"));
	   mc2.x=475.82;
	   mc2.y=708.67;
	   this.addChild(mc2);
	   this.start.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
		   if(this.click ==0){
			   mc.play(-1);
		   	setTimeout(function(){
			    mc1.play(-1);
			},300);
			setTimeout(function(){
				mc2.play(-1);
			},600);
			setTimeout(function() {
				mc.stop();
				console.log(mc.currentFrame);
			}, 3000);
			setTimeout(function() {
				mc1.stop();
			}, 3300);
			setTimeout(function() {
				mc2.stop();
			}, 3600);
			
		   }
			this.click++;			
	   },this);     
	}
	private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean): void {
		if (isLoop) {
			for (var key in target.items) {
				target.items[key].props = { loop: true};
			}
		}
		target.play();
	}
}